package com.medata.service.impl;

import com.medata.dataObject.Docobject;
import com.medata.repository.DocobjectRepository;
import com.medata.service.DocobjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

/**
 * @author ：zb
 * @date ：Created in 2019/5/13 0013 19:30
 * @description：
 */
@Service
public class DocobjectServiceImpl implements DocobjectService {
    @Autowired
    private DocobjectRepository docobjectRepository;
    @Override
    public String saveOrUpdate(Docobject docobject) {
        docobjectRepository.save(docobject);
        return "1";
    }

    @Override
    public List<Docobject> findByDocidAndClientfullpath(String docId, String path) {
        List<Docobject> docs = docobjectRepository.findByDocidAndClientfullpath(docId, path);
        return docs;
    }

    @Override
    @Transactional
    public void deleteByObjectid(String objectId) {
        docobjectRepository.deleteByObjectid(objectId);
    }

    @Override
    public Docobject findAllByObjectid(String objId) {
        Docobject docobject = docobjectRepository.findAllByObjectid(objId);
        return docobject;
    }

    @Override
    public List<Docobject> findByDocidAndDbid(String docid, String dbid) {
        return docobjectRepository.findByDocidAndDbid(docid,dbid);
    }
}
